<?php
namespace app\test01\controller;

use app\common\controller\Base as CommonBase;
use app\common\exception\ForbidenException;
use app\common\model\SystemConfig as SystemConfigModel;
use think\App;
use think\facade\Session;
use app\common\model\Auth as AuthModel;
use app\common\model\ManagerRole as ManagerRoleModel;
use app\common\model\Role as RoleModel;
use app\common\model\RoleAuth as RoleAuthModel;
use think\facade\Env;

class Base extends CommonBase
{
    //当前的模块
    protected $current_module = 'manage';

    //当前的控制器
    protected $current_controller = '';

    //当前的方法
    protected $current_action = '';


    protected $breads = array();
    public $bodyData = array();
    private $selfDomain='';

    public function __construct(App $app = null)
    {
        // var_dump($_SERVER['HTTP_HOST']);
        $envDomain=Env::get('environment.manage');
        if($envDomain&&$envDomain!=$_SERVER['HTTP_HOST']){
            exit("您迷路了".$_SERVER['HTTP_HOST']);
        }
        $this->selfDomain=$_SERVER['HTTP_HOST'];
        parent::__construct($app);
        $prebody = $_POST;
		foreach ($prebody as $k => $v) {
            if(is_string($v)){
                $this->bodyData[$k] = htmlspecialchars($v);
            }else{
                $this->bodyData[$k] = ($v);
            }
           
        }
		$prebody = $_GET;
		foreach ($prebody as $k => $v) {
            $this->bodyData[$k] = htmlspecialchars($v);
        }
		$prebody = file_get_contents("php://input");
		if($prebody&&json_decode($prebody)){
			$prebody=json_decode($prebody,true);		
		}else{
			$prebody=[];
		}
		foreach ($prebody as $k => $v) {
			
            $this->bodyData[$k] = htmlspecialchars($v);
        }
      
        logToTmp( $this->selfDomain,$prebody);
        $this->assign('self_domain',$this->selfDomain);
    }
    
}